<?php
//https://packagist.org/packages/khr/php-mcurl-client
require 'vendor/autoload.php';

use MCurl\Client;

$client = new Client();
$client->setMaxRequest(20); // set 20 parallel request

$start = microtime(true);
echo "Fetching..." . PHP_EOL;
foreach (range(1, 60) as $item) {
    $client->add([CURLOPT_URL => "http://127.0.0.1:9501/test/slow_api?r=" . $item]);
}
// wait all request
// @var $results Result[]
$results = $client->all();
echo "...done in " . (microtime(true) - $start) . PHP_EOL;
$data = [];
foreach ($results as $r) {
    $data[] = $r->body;
}

print_r($data);